package com.travel.service.impl;

/**
 * 景点评论业务
 * @author zourenhe
 *
 */

import java.util.List;

import com.travel.dao.ScenicCommentDao;
import com.travel.dao.impl.ScenicCommentDaoImpl;
import com.travel.entity.ScenicComment;
import com.travel.service.ScenicCommentService;
import com.travel.util.PageInfo;

public class ScenicCommentServiceImpl implements ScenicCommentService{

	private  ScenicCommentDao  sceniccommentdao= new ScenicCommentDaoImpl();
	
	@Override
	public List<ScenicComment> getScenicCommentList() {
		return sceniccommentdao.find();
	}

	@Override
	public boolean deleteById(int commentId) {
		int i = sceniccommentdao.deleteById(commentId);
		
		return  i > 0 ? true : false;
	}

	@Override
	public boolean insert(ScenicComment scenicComment) {
		int i=sceniccommentdao.insert(scenicComment);
		return i==1 ? true : false;
	}

	@Override
	public PageInfo<ScenicComment> getUserListByPage(int pageNum, int pageSize) {
		// TODO Auto-generated method stub
		if (pageNum <= 0) {
			pageNum = 1;
		}
		if (pageSize <= 0) {
			pageSize = 2;
		}
		return sceniccommentdao.findByPage(pageNum, pageSize);
	}

	
	
}
